import { defineStore } from 'pinia';
import { GroupItem } from './types';

const useGroupStore = defineStore('group', {
  state: (): GroupItem => ({
    groupwxid: '', // 当前选中的群id
    groupnick: '',
    avatarMinUrl: '',
    avatarMaxUrl: '',
    issave: false,
    isauto: false,
  }),

  getters: {
    
  },

  actions: {
    // 设置当前选中群的的 wxid 和 avatar
    selectedGroup(groupwxid: string, avatarMaxUrl: string, groupnick: string, issave: boolean, isauto: boolean) {
      this.groupwxid = groupwxid;
      this.avatarMaxUrl = avatarMaxUrl;
      this.groupnick = groupnick;
      this.issave = issave;
      this.isauto = isauto;
    },
  },
});

export default useGroupStore;